#!/bin/sh
v_path_mysql_server="/tmp/atwork/MySQL-server-5.6.16-1.rhel5.x86_64.rpm"

v_path_mysql_client="/tmp/atwork/MySQL-client-5.6.16-1.rhel5.x86_64.rpm"
#检测是否安装了MYSQL
v_installed_mysql=`rpm -qa | grep "MySQL"`
#检测是否安装了指定的MYSQL
v_mysql_56=`echo $v_installed_mysql | grep "MySQL-server-5.6"`

f_uninstall_mysql(){
 echo "uninstall mysql $v_installed_mysql"
 `rpm -e $v_installed_mysql`
}

f_install_mysql(){
 echo "Installing Mysql Server"
 `rpm -ivh $v_path_mysql_server`
 echo "Installing Mysql Client"
 `rpm -ivh $v_path_mysql_client`
}

f_reset_passwd(){
}

if [ "X$v_mysql_56" != "X" ]; then
 echo "Mysql 5.6 already Installed!!"
elif [ "X$v_installed_mysql" != "X" && "X$v_msyql_56" = "X" ];then
 echo "Mysql Installed,But is not version 5.6,Reinstall Again"
 f_uninstall_mysql
 f_install_mysql
elif [ "X$v_installed_mysql" = "X" ]; then
 echo "Mysql Not Installed"
 f_install_mysql
fi
